﻿using FunArts.EasyDevOps.Shared.Models.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FunArts.EasyDevOps.Shared.Models.SshClient.Command
{
    /// <summary>
    /// 删除文件或目录命令
    /// </summary>
    public class DeleteCommand : ILinuxCommand
    {
        /// <summary>
        /// 文件或目录路径
        /// </summary>
        public string Path { get; set; } 
        /// <summary>
        /// 是否递归删除
        /// </summary>
        public bool Recursive { get; set; } 

        public DeleteCommand(string path, bool recursive = false)
        {
            Path = path;
            Recursive = recursive;
        }

        public string BuildCommand(SystemVersionTypeEnum systemVersionType)
        {
            return Recursive ? $"rm -rf {Path}" : $"rm -f {Path}";
        }
    }
}
